package com.program.beautymakeup.service;

import com.program.beautymakeup.utils.UploadUtil;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author bytedance
 * @ClassName UploadService.java
 * @Description TODO
 * @createTime 2023年02月07日 00:11:00
 */
@Service
public class UploadService {
    //获取根路径
    private String dirPath = "../static/";

//    @Autowired
//    private UploadMapper uploadMapper;


    public String uploadImg(List<MultipartFile> fileList, HttpServletRequest request) {
        Boolean img =UploadUtil.checkImg(fileList);
        if (img){
            String URL= UploadUtil.upload(fileList,request,dirPath);
            return URL;
        }else {
            return "请上传bmp/gif/jpg/png格式的图片";
        }
    }
}
